//package com.manlost.backoffice.controller.upload;
//
//import java.io.File;
//import java.util.ArrayList;
//import java.util.Date;
//import java.util.List;
//
//import org.apache.commons.logging.Log;
//import org.apache.commons.logging.LogFactory;
//import org.springframework.stereotype.Controller;
//import org.springframework.ui.ModelMap;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestParam;
//
//import com.manlost.biz.ManlostServiceLocator;
//import com.manlost.biz.baby.BabyService;
//import com.manlost.biz.baby.model.dataobject.Baby;
//import com.manlost.thumbnail.util.ThumbnailConstant;
//import com.manlost.upload.model.dto.PathInfoDTO;
//import com.manlost.upload.sourceImage.impl.SourceFilePathInfoService;
//
///**
// * @author: HuJianbo (hujianbo88@sohu.com)
// * @date: 2012-4-15
// * @description:
// */
//@Controller
//@RequestMapping("/upload/resizeupload.htm")
//public class ResizeUploadController {
//
//    private Log                       log         = LogFactory.getLog(ResizeUploadController.class);
//    private BabyService               babyService = ManlostServiceLocator.getBabyService();
//    private SourceFilePathInfoService pathService = new SourceFilePathInfoService();
//
//    @RequestMapping
//    public String resizeUpload(@RequestParam("abstractPath")
//    String path, ModelMap model) {
//        List<Baby> babyList = new ArrayList<Baby>();
//        PathInfoDTO dto = new PathInfoDTO();
//        List<String> babyNames = new ArrayList<String>();
//        Baby baby = new Baby();
//        dto = pathService.getOnePathInfo(path);
//        babyNames = pathService.getBabyNames(path);
//        log.info("==========babyNames: " + babyNames.toString());
//        String picRealPath = null;
//        for (String babyName : babyNames) {
//            picRealPath = dto.getAbstractPath() + File.separator + babyName;
//            log.info("============picRealPath is: " + picRealPath);
//            baby.setId(pathService.getBabyId());
//            baby.setSourcePicName(babyName);
//            baby.setBabyYear(dto.getYear());
//            baby.setBabyMonthDate(dto.getMonDay());
//            baby.setBabySource(dto.getSource());
//            baby.setBabyAlbum(dto.getAlbum());
//            baby.setCreateDate(new Date());
//            baby.setImageRaw(picRealPath);
//
//            babyService.insetOneBaby(baby);
//
//            // generate thumbnails
//            pathService.generateThumbnail(picRealPath, ThumbnailConstant.THUMBNAIL_ROOT_PATH, 500);
//            pathService.generateThumbnail(picRealPath, ThumbnailConstant.THUMBNAIL_ROOT_PATH, 260);
//
//        }
//
//        // TODO generate next page info
//
//        return "upload/resizeupload";
//    }
//}
